package com.qdsg.ysg.doctor.ui.adapter

import android.annotation.SuppressLint
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.qdsg.ysg.doctor.R
import com.rest.response.DrugResponse
import java.util.regex.Matcher
import java.util.regex.Pattern

/**
 * @Description: 药品目录适配器
 * @Author: lzp
 * @CreateDate: 2022/3/9 15:01
 * @UpdateRemark: 更新说明
 */
class DrugDirectoryAdapter(data: MutableList<DrugResponse.Drug>) : BaseQuickAdapter<DrugResponse.Drug, BaseViewHolder>(R.layout.item_drug_directory, data) {

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: DrugResponse.Drug) {
        holder.setText(R.id.tv_drug_name, item.name)

//        item.drugSpecification.matches(Regex("[0-9]+.[0-9]+"))
//        Regex("[0-9]+.[0-9]+").matches(item.drugSpecification)

        holder.setText(R.id.tv_drug_specification, item.drugSpecification)
        holder.setText(R.id.tv_drug_factory, "生产厂商：${item.manufacturer}")
    }
}